package com.ian.homework;

public enum PhoneEnumType {
    BIG_CARD("大卡", 1), MIN_CARD("小卡", 2), MICO_CARD("微型卡", 3);

    private String name;
    private int index;

    PhoneEnumType(String name, int index) {
        this.name = name;
        this.index = index;
    }

    public static String getName(int index) {
        for (PhoneEnumType c : PhoneEnumType.values()) {
            if (c.getIndex() == index) {
                return c.name;
            }
        }
        return null;
    }

    // get set 方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

}
